import globals from "globals";
import pluginJs from "@eslint/js";
import pluginVue from "eslint-plugin-vue";
import eslintConfigPrettier from "eslint-config-prettier";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";

/** @type {import('eslint').Linter.Config[]} */
export default [
  { files: ["**/*.{js,mjs,cjs,vue}"] },
  {
    languageOptions: {
      globals: {
        ...globals.browser,
        ...globals.module,
        ...globals.exports,
        ...globals.require,
        ...globals.process
      }
    }
  },
  pluginJs.configs.recommended,
  ...pluginVue.configs["flat/essential"],
  // prettier融合配置
  eslintConfigPrettier,
  eslintPluginPrettierRecommended,
  // 新增添加内容：这里我们可以添加自己的 rules
  {
    rules: {
      "no-undef": "off",
      "no-unused-vars": "error"
    }
  },
  {
    ignores: ["node_modules/"] // 忽略目录
  }
];
